package jalgebrava.group.properties;

import jalgebrava.group.Group;
import jalgebrava.util.F;

public abstract class GroupProperty<G, Result> extends F<Group<G>, Result> {
	private final String name; 
	private final Group<G> g;
	public GroupProperty(String n, Group<G> group) {
		this.name = n;
		this.g = group;
	}
	public final String getName() {
		return name;
	}
	public final Result compute() {
		return g.get(this);
	}
	@Override
	public final String toString() {
		if (g == null) {
			return name + "@null";
		}
		return name + "@" + g.toString();
	}
	public abstract Result compute(Group<G> group);
	@Override
	public Result apply(Group<G> a) {
		return a.get(this);
	}

	
}
